package com.hjl.cn.filter;

import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;

import javax.servlet.http.HttpServletRequest;

/**
 * @author jialin
 * @createTime 2020-10-15
 */
public class MyFilter extends ZuulFilter {

    //进入要转发的地址之前
    @Override
    public String filterType() {
        return "pre";
    }

    @Override
    public int filterOrder() {
        return 0;
    }

    //是否要过滤
    @Override
    public boolean shouldFilter() {
        return true;
    }

    @Override
    public Object run() {
        RequestContext cxk = RequestContext.getCurrentContext();
        HttpServletRequest request = cxk.getRequest();
        request.getParameter("");
        // TODO: 2020/10/15  
        //不给转
        cxk.setSendZuulResponse(false);
        cxk.setResponseStatusCode(500);
        return "redirects";
    }
}
